import {defineStore} from 'pinia'
import {
    requesAdminBasicRoleAdd,
    requesAdminBasicRoleAssignRoles,
    requesAdminBasicRoleDelete,
    requesAdminBasicRoleList,
    requesAdminBasicRoleResetPassword,
    AdminBasicRoleAdd,
    ResetPassword,
    RoleAssignRoles,
    RoleDelete,
    RoleList
} from '../service/role'

// 账户管理
export default defineStore('useRoleStore', () => {

    // 新增用户
    const roleAdd = async (adminBasicRoleAdd: Partial<AdminBasicRoleAdd>) => {
        const res = await requesAdminBasicRoleAdd(adminBasicRoleAdd)
        console.log(res, "| res");
    }

    // 分配角色
    const roleAssignRoles = async (roleAssignRoles: Partial<RoleAssignRoles>) => {
        const res = await requesAdminBasicRoleAssignRoles(roleAssignRoles)
        console.log(res, "| res");
    }

    // 删除用户
    const roleDel = async (roleDelete: Partial<RoleDelete>) => {
        const res = await requesAdminBasicRoleDelete(roleDelete)
        console.log(res, "| res");
    }

    // 获取用户列表-分页
    const roleList = async (roleList: Partial<RoleList>) => {
        const res = await requesAdminBasicRoleList(roleList)
        console.log(res, "| res");
    }

    // 重置密码
    const roleResetPassword = async (resetPassword: Partial<ResetPassword>) => {
        const res = await requesAdminBasicRoleResetPassword(resetPassword)
        console.log(res, "| res");
    }

    return {
        roleAdd,
        roleAssignRoles,
        roleDel,
        roleList,
        roleResetPassword
    }
})